<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            height: 3000px;
        }

        .foot{
            width: 1000px;
            height: 100px;
            background-color: #eee;
            position: fixed;
            left: 0;
            right: 0;
            margin: auto;
            bottom: 0;
            text-align: center;
            line-height: 100px;
            display: none;
        }
    </style>
</head>
<body>

    <div class="foot">别啦了，到底啦</div>


    <script>

        var oFoot = document.querySelector('.foot');

        var pageHeight = document.documentElement.scrollHeight ;
        var browserHeight = document.documentElement.clientHeight ;

        window.onscroll = function() {
            // 页面滚动的高度  不一定刚好等于
            console.log(document.documentElement.scrollTop);
            console.log(pageHeight - browserHeight  );
            // 在页面快要到达底部的时候  - 10
            if(document.documentElement.scrollTop >= pageHeight - browserHeight - 10) {
                // alert(666)
                oFoot.style.display = 'block' ;
            }
            else {
                oFoot.style.display = 'none' ;
            }
        }

    </script>
    
</body>
</html>